/**
 * 用户详情对话框
 */
var UserInfoDlg = {
    data: {
        deptId: "",
        deptName: ""
    }
};

layui.use(['layer', 'form', 'admin', 'laydate', 'ax', 'formSelects'], function () {
    var $ = layui.jquery;
    var $ax = layui.ax;
    var form = layui.form;
    var admin = layui.admin;
    var laydate = layui.laydate;
    var layer = layui.layer;
    var formSelects = layui.formSelects;
    var uid = Feng.getUrlParam("userId");


    // 添加表单验证方法
    form.verify({
        psw: [/^[\S]{6,12}$/, '密码必须6到12位，且不能出现空格'],
        repsw: function (value) {
            if (value !== $('#userForm input[name=password]').val()) {
                return '两次密码输入不一致';
            }
        }
    });



    // 表单提交事件
    form.on('submit(btnSubmit)', function (data) {
        Feng.confirm("是否修改密码为" + $("#password").val() + "?", function () {
            var ajax = new $ax(Feng.ctxPath + "/mgr/updatePws", function (data) {
                Feng.success("修改密码成功!");
            }, function (data) {
                Feng.error("修改密码失败!"+ data.responseJSON.message);
            });
            ajax.set("userId",   uid);
            ajax.set("password", data.password);
            ajax.set("oldPassword", data.oldPassword);

            ajax.start();
        });
    });




});